package com.atguigu.gmall.activity.redis;

import com.atguigu.gmall.activity.util.CacheHelper;
import org.springframework.stereotype.Component;

/**
 * @Author: lx
 * @Time: 14:26
 * @Description:
 *
 *   监听到Redis发布订阅模式下的消息 处理实现类
 */
@Component
public class MessageReceive {


    //接收消息
    public void receiveMessage(String message){
        //seckillGoods.getSkuId() + ":1"
        //     "30:1"
        //   30:1
        message = message.replaceAll("\"","");

        //  o:skuId  1:状态位
        String[] m = message.split(":");
        System.out.println("将状态位已经保存到本地缓存中了：" + message);

        //放到本地内存中 JUC 本地缓存中   Mybatis源代码  一二缓存
        CacheHelper.put(m[0],m[1]);
    }
}
